package com.briup.day02;

public class Test_Char {
    //输出各种常量值
    public static void main(String[] args) {
        System.out.println(10); // int
        System.out.println(0b0110); // ?
        System.out.println(026); // ?
        System.out.println(0x1c); // ?
        System.out.println(5.5); // double
        System.out.println('a'); // char
        System.out.println(true); // boolean
        System.out.println("欢迎来到杰普软件"); // String
        byte b = 10;
        short s = 5;
// (byte -> int) + (short -> int)
// int + int
// 结果为 int
        int sum = b + s;
// 下一行编译报错，int 无法自动转换为 short进行赋值
//short sum2 = b + s;
        System.out.println(sum);
    }

    public static void main03(String[] args) {
        char c1 = '\n';
        System.out.println("c1: " + c1);
        char c2 = '\t';
        System.out.println("c2: " + c2);
        System.out.println(c2 == 9);
        char c3 = '\'';
        System.out.println("c3: " + c3);
        System.out.println("----------------------------------");
        String str1 = "Hello, \"World\"!"; // 使用转义字符表示双引号
        String str2 = "I\'m Java programmer."; // 使用转义字符表示单引号
        String str3 = "C:\\path\\to\\file.txt"; // 使用转义字符表示反斜杠
        String str4 = "First line\nSecond line"; // 使用转义字符表示换行
        String str5 = "Hello\tworld!"; // 使用转义字符表示制表符
        String str6 = "Unicode character: \u03A9"; // 使用 Unicode 转义表示特殊字符
        System.out.println(str1);
        System.out.println(str2);
        System.out.println(str3);
        System.out.println(str4);
        System.out.println(str5);
        System.out.println(str6);


        System.out.println(-123);//64 32 16  8 2 1  原1 0（23）  0111 1011反1000 0100补10000101


    }

    public static void main02(String[] args) {
        char c1 = 'a';
        char c2 = 97;
        char c3 = 0141;
        char c4 = 0x61;
        char c5 = '\u0061';
        System.out.println(c1 + " " + c2 + " " + c3 + " " + c4 + " " + c5);
    }

    public static void main01(String[] args) {
        char c1 = 48;
        char c2 = 65;
        char c3 = 97;
        System.out.println(c1);
        System.out.println(c2);
        System.out.println(c3);
        System.out.println("----------------");
//        int num = '中';
        char c4 = 20013;
//        System.out.println(num);
        System.out.println(c4);
    }
}
